#ifndef actionparser_h
#define actionparser_h

#include <vector>
#include <map>

#include "Action.h"
#include "Utility.h"

enum VoteMode
{

	VOTE_LEFT,
	VOTE_RIGHT

};

class ActionParser
{

	private:
	
		// Config
		int maxActions;
		int maxRepeats;
		bool multiAllowed;
		bool multiVotingOnly;
		bool votingEnabled;
		std::string votingLeftTerm;
		std::string votingRightTerm;
		std::vector< std::string > * allowedActions;
		
		// Vector of current actions
		std::vector< Action > * actions;
		
		// The current vote count
		int voteBounds;
		int voteCount;
		int actionVoteThreshold;
		VoteMode voteMode;
		std::map< std::string, int > voteActions;
		
		// For input
		std::string windowName;
		int keyDelay;
		
		// Functionality
		bool canAddAction( std::string name );
		int typeToKey( std::string name );
		std::vector< Action > * parseMultiAction( std::string message, std::string user );
	
	public:
	
		// Constructors
		ActionParser( char * inipath );
		
		// Destructor
		~ActionParser();
		
		// Getters
		int getMaxActions() const;
		std::vector< std::string > * getAllowedActions() const;
		int getNumActions() const;
		Action * getAction( int index ) const;
		VoteMode getVoteMode();
		
		// Setters
		void setMaxActions( int maxActions );
		void setAllowedActions( std::vector< std::string > * allowedActions );
		void addAction( Action & action );
		void addAction( const char * user, const char * message );
		void addMultiAction( std::string message, std::string user );
		
		// Functionality
		void printActions();
		void performAction();
		void performAllActions();
		void voteAction( std::string message, std::string user );
		void voteMultiAction( std::string message, std::string user );

};

#endif
